package JavaSE.CODE.ClassInCommonUse.StringPro;

public class Buffer {
    public static void main(String[] args) {

        StringBuilder sb = new StringBuilder();
        //1.append(String str)
        sb.append("java!!");
        System.out.println(sb);
        //2.insert(int index, String str) 在指定位置上插入字符串
        sb.insert(0,"i am first");
        System.out.println(sb);
        //3.replace(int start, int end, String str) 把从start(含)到end(不含)的字符替换成str
        //str不具有把指定字符串替换成特定字符串的能力，只能把从start到end的内容替换掉
        sb.replace(0,2,"jj");
        System.out.println(sb);
        //4.delete()
        sb.delete(0,5);
        System.out.println(sb);
        //sb的每个操作都会在原字符串上进行修改，而不用像String一样，str = str.xxx;
        //清空
        sb.delete(0,sb.length());
        System.out.println(sb.length());


    }
}
